#ifndef GLYPH_DATA_h
#define GLYPH_DATA_h
#include <vector>
#include <ft2build.h>
#include FT_FREETYPE_H //Include main FREETYPE2 API

class GlyphData
{
public:
	GlyphData();
	bool LoadGlyph(const char* strTypeface, int point_size, int dpi);
	void LogError(){ fprintf(stderr, "%s", error); }
	void LogSuccess(const char* strText){ fprintf(stdout, "%s", strText); }
	void InitiliazeChars(char * source);
	~GlyphData();

protected:
	struct Data
	{
		char c;     // the character of this glyph
		int size;   // font size

		int bitmap_width;   // texture width
		int bitmap_rows;    // texture height
		unsigned char *bitmap_buffer;   // texture data
		FT_Vector advance;  // this variable contains the information of how much we need to move to the right from the last character
		int bitmap_left;    // width of the glyph in pixels
		int bitmap_top;     // height of the glyph in pixels
	};
	std::vector<Data> glyphs;

private:
	bool IntiliazeFont(const char* strTypeface, int point_size, int dpi);
	FT_Library  library;	/* handle to library     */
	FT_Face     face;      /* handle to face object */
	FT_GlyphSlot glyph;         /*Access glyph information*/
	char* error;
};

#endif